<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
    use Notifiable;
	use SoftDeletes;

    protected $table = 'admin';

	/**
	 * 可分配的属性。
	 *
	 * @var array
	 */
	protected $fillable = [
		'username','password','nickname','age','thumb','sex','status'
	];

	/**
	 * 应该为数组隐藏的属性。
	 *
	 * @var array
	 */
	protected $hidden = [
		'password',
	];

	/**
	 * 关联角色
	 * User: ihome
	 * @return \Illuminate\Database\Eloquent\Relations\belongsToMany
	 */
	public function role()
	{
		return $this->belongsToMany(Role::class,'admin_role','admin_id','role_id')->withTimestamps();
	}
}
